extends EventListener


class_name Knockback


@export var gravity_element: GravityElement = null


func on_effect(type: CharacterUnit.Effect, e: CharacterEvent) -> void:
    match type:
        CharacterUnit.Effect.DO_KNOCKBACK:
            if gravity_element:
                gravity_element.velocity = e.meta.force * e.meta.direction
                gravity_element.lerp_weight = e.meta.weight
